How to extract the hostname portion of a URL in JavaScript